const express = require('express')
const path = require('path')

const router = express.Router()

const userRouter = require('./user')
const authRouter = require('./auth')
const roleRouter = require('./role')
const catRouter = require('./cat')
const dishRouter = require('./dish')
const uploadsRouter = require('./uploads')
const dataRouter = require('./data')

router.use('/api/user', userRouter)
router.use('/api/auth', authRouter)
router.use('/api/role', roleRouter)
router.use('/api/cat', catRouter)
router.use('/api/dish', dishRouter)

router.use('/api/uploads', uploadsRouter)

router.use('/api/data', dataRouter)

const uploadsPath = path.join(__dirname, '../', '../', 'uploads')
router.use('/uploads', express.static(uploadsPath))

module.exports = router